Expressions and Operators (Cont.)
Conditional expressions
Conditional expression evaluates to expr2 pr expr 3, depending whether expr1 is true (non-0) or not.
w Expr1 ? Expr2 : Expr3;
wEXAMPLE: set x to the maximum of a and b
w x = a > b ? a : b;
w
Conditional expressions can be nested inside other expressions
wEXAMPLE: x = sqrt(a > 0 ? a : -a);